package com.IR.user.action;

import java.io.IOException;
import java.io.PrintWriter;
import java.text.ParseException;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.IR.shop.po.Collects;
import com.IR.user.service.ACollectsBiz;

@Controller
public class ACollectsAction {

	@Resource
	public ACollectsBiz biz;
	private Collects collects;
	private List<Collects> list;
	public Collects getCollects() {
		return collects;
	}
	public void setCollects(Collects collects) {
		this.collects = collects;
	}
	public List<Collects> getList() {
		return list;
	}
	public void setList(List<Collects> list) {
		this.list = list;
	}
	@RequestMapping(value="saveCollect.do")
	public void saveCollects(HttpServletRequest request,HttpServletResponse response) throws ParseException, IOException {
		response.setHeader("Access-Control-Allow-Origin", "*");
		response.setCharacterEncoding("utf-8");
		Long userid=new Long(request.getParameter("userid"));
		Long proid=new Long(request.getParameter("proid"));
		biz.saveCollects(proid, userid);
		PrintWriter out = response.getWriter();
		out.println(1);
	}
	@RequestMapping(value="deleteCollect.do")
	public void deleteCollects(HttpServletRequest request,HttpServletResponse response) throws IOException{
		response.setHeader("Access-Control-Allow-Origin", "*");
		response.setCharacterEncoding("utf-8");
		int collectid=new Integer(request.getParameter("collectid"));
		biz.deleteCollects(collectid);
		PrintWriter out =response.getWriter();
		out.println(1);
	}
}
